package org.learn.java;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
    	//数据收集
    	Scanner scanner = new Scanner(System.in);
    	System.out.println("集合A：");
    	String value = scanner.nextLine();
    	String[] array = value.split(",");
    	List<String> a = Arrays.asList(array);
    	printList(a);
    	
    	System.out.println("集合B：");
    	String valueb = scanner.nextLine();
    	String[] arrayb = valueb.split(",");
    	List<String> b = Arrays.asList(arrayb);
    	printList(b);
    	
    	Set<String> c = new HashSet<String>();
    	
    	c.addAll(a);
    	c.addAll(b);
    	
    	for (String d : b) {
    		if(a.contains(d)){
        		c.remove(d);
        	}
		}
    	System.out.println("集合C：");
    	printList(c);
    }
    
    public static <T> void printList(Collection<T> c){
    	for (T t : c) {
			System.out.print(t+",");
		}
    	System.out.println();
    }
}
